<template>
  <div class="rights">
      <el-table v-loading="isLoading" :data="rightList" border style="width:100%">
           <el-table-column type="index"></el-table-column>
           <el-table-column prop="authName" label="权限名称" align="center"></el-table-column>
           <el-table-column prop="path" label="路径" align="center"></el-table-column>
           <el-table-column label="层级" align="center">
                <template slot-scope="scope">
                  <el-tag v-if="scope.row.level==='0'" size="medium" type="success" effect="dark">一级</el-tag>
                  <el-tag v-else-if="scope.row.level==='1'" size="medium" type="warning" effect="dark">二级</el-tag>
                  <el-tag v-else size="medium" type="danger" effect="dark">三级</el-tag>
                </template>
            </el-table-column> 
      </el-table>
  </div>
</template>

<script>
import {getRightList} from '@/api/index'

export default {
  data () {
    return {
      isLoading:false,
      rightList:[]
    }
  },
  created () {
    this.isLoading = true
    getRightList({type:'list'}).then(res => {
      if(res.meta.status===200){
        this.rightList = res.data
        this.isLoading = false
        console.log(this.rightList);
      }
    })
  }
}
</script>

<style>

</style>